<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<link rel="stylesheet" href="${basePath }static/css/cwx/addinfo/bootstrap.min.css" />
<link rel="stylesheet" href="${basePath }static/css/cwx/addinfo.css" />
<link rel="stylesheet" href="${basePath }static/css/addinfo/city-picker.css">
<link rel="stylesheet" href="${basePath }static/js/HomePageJs/layer-v3.1.1/layer/theme/default/layer.css" />

</head>

<body id="addbody">
	<div class="container">
		<h2 class="h2">添加收货人信息</h2>
		<div class="docs-methods">
			<form class="form-inline" id="addinfo"  action="${basePath }RecMsgSaveAction" method="post">
				<div id="shouhuoren">
					<label>收货人姓名 :</label> <input type="text" name="recname" id="recname"
						placeholder="请输入收货人姓名" />
				</div>
				<div id="shouhuoren">
					<font>收货人联系电话:</font> <input type="text" name="rectel" id="rectel"
						placeholder="请输入联系电话" />
				</div>
				<div id="shouhuoren">
					<font>邮政编码:</font> <input type="text" name="postcode" id="postcode"
						placeholder="请输入邮政编码" />
				</div>
				<font>收货地址:</font>
				<div id="distpicker">
					<div class="form-group">
						<div style="position: relative;">
							<input id="city-picker3" name="recaddress" class="form-control"
								readonly type="text" placeholder="省/市/区"
								data-toggle="city-picker">
						</div>
					</div>
					<div class="address">
						<input type="text" name="addressdetail" id="addressdetail"
							placeholder="请输入详细地址" />
					</div>
					<div class="form-group" id="button">
						<button class="btn btn-default" id="reset" type="button">重置</button>
						<button class="btn btn-danger" id="destroy" type="submit" onclick="return subAdd()"
							style="margin-left: 100px">确定</button>
					</div>
				</div>
			</form>
		</div>
	</div>
</body>
	<script type="text/javascript"	src="${basePath }static/js/addinfo/jquery-1.12.1.min.js"></script>
	<script type="text/javascript"	src="${basePath }static/js/addinfo/bootstrap.min.js"></script>
	<script type="text/javascript"	src="${basePath }static/js/addinfo/city-picker.data.js"></script>
	<script type="text/javascript"	src="${basePath }static/js/addinfo/city-picker.js"></script>
	<script type="text/javascript"  src="${basePath }static/js/addinfo/main.js"></script>
	<script type="text/javascript"	src="${basePath }static/js/HomePageJs/layer-v3.1.1/layer/layer.js"></script>
<script type="text/javascript">
	// 验证form表单是否合法
	function subAdd() {
		// 错误提示信息
		var strMsg = "";
		// 收货人验证
		var recname = document.getElementById("recname").value;
		if (recname == null || recname == "") {
			// 增加提示信息
			strMsg += "请输入收货人姓名!<br>";
		}
		// 收货人手机号验证
		var regModile = /^1\d{10}$/;
		var rectel = document.getElementById("rectel").value;
		if (rectel == null || rectel == "" || regModile.test(rectel) === false) {
			// 增加提示信息
			strMsg += "请输入正确的手机号!<br>";
		}
		//邮政编码验证
		// 手机号验证
		var regCode = /^\d{6}$/;
		var postcode = document.getElementById("postcode").value;
		if (postcode == null || postcode == "" || regCode.test(postcode) === false) {
			// 增加提示信息
			strMsg += "请输入正确的邮政编码!<br>";
		}
		//详细收获地址验证
		var postcode = document.getElementById("addressdetail").value;
		if (postcode == null || postcode == "" ) {
			// 增加提示信息
			strMsg += "请输入详细地址!<br>";
		}
		
		// 判定整个表单是否可以进行提交
		if (strMsg == "") {
			//验证通过 
			return true;
			
		} else {
			// 验证不通过
			layer.open({
				title : '提示',
				content : strMsg
			});
			return false;
		}
	}
	// 手动提交form表单
	function doSubmit() {
		document.getElementById("addinfo").submit();
	}
</script>

</html>